import axios from '../utils/request' // 引入axios网络请求方法
import store from '@/store'
export const login = data => axios({
  url: '/v1_0/authorizations',
  method: 'POST',
  data
  /**
     * data: data(前面的data是axios固定配置项, value是形参, 同名简写)
     * data: {
     *  mobile: 13900000000,
     *  code: 246810
     * }
     * // axios为啥传data进去, axios会把data里的key+value放到请求体里 (后台这个接口从请求体提取数据)
     */
})
// 更新 - token
export const refreshToken = () => axios({
  url: '/v1_0/authorizations',
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${store.state.refresh_token}`
  }
})
